package com.dot.dominion.boardview;

import java.util.List;

import android.app.Activity;
import android.content.Intent;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;

import com.dot.dominion.Constants;
import com.dot.dominion.domain.Card;
import com.dot.dominion.view.CardView;

public class BoardListener implements OnItemClickListener {
	private Activity context;
	private List<Card> cardList;
	
	public BoardListener(Activity context, List<Card> list) {
		this.context = context;
		cardList = list;
	}
	
	public void onItemClick(AdapterView<?> parent, View v, int position,
			long id) {
		Intent cardView = new Intent( context, CardView.class );
		
		Card card = cardList.get(position);
		
		cardView.putExtra(Constants.PICTURE_ID, card.getPictureId());
		
		context.startActivityForResult(cardView, Constants.CARD_VIEW);
	}
}
